package com.hackerrank.www;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created by 27340 on 2017/5/6.
 */
public class ReadUtil {
    static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer tok = null;

    public static String gets() throws IOException {
        if(tok == null || !tok.hasMoreTokens())
            tok = new StringTokenizer(br.readLine());
        return tok.nextToken();
    }

    public static int getInt() {
        try {
            return Integer.parseInt(gets());
        } catch(IOException | NumberFormatException e) {
            return -1;
        }
    }

    static String getStr() {
        try {
            return gets();
        } catch(IOException | NumberFormatException e) {
            return "";
        }
    }
}
